//
//  STProductDeitailBottomView.m
//  CuiBoStore
//
//  Created by 崔博 on 16/12/12.
//  Copyright © 2016年 崔博. All rights reserved.
//

#import "STProductDeitailBottomView.h"
#import "STProductBannerModel.h"
@implementation STProductDeitailBottomView
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self == [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor redColor];
    }
    return self;
}


#pragma mark - set
- (void)setImageArray:(NSArray *)imageArray
{
    _imageArray = imageArray;
    CGFloat imageY = 0;
    for (STProductBannerModel *m in imageArray) {
        NSArray *sizeArray = [m.Resolution componentsSeparatedByString:@"*"];
        CGFloat h = SCREEN_WIDTH / [sizeArray[1] floatValue] * [sizeArray[0] floatValue];
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, imageY, SCREEN_WIDTH, h)];
        [imageView downloadImage:m.ImgView placeholder:nil];
        imageY += h;
        [self addSubview:imageView];
    };
    if (_block) {
        _block(imageY);
    }
}

@end
